<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Programming a Custom Brain</title>
</head>

<body text="#FFFFFF" bgcolor="#000000" style="font-family: Verdana; font-size: 10pt" link="#00FFFF" vlink="#00FFFF" alink="#00FFFF">

<p><font size="3"><b>Programming a Custom Brain</b></font></p>
<p>To create a new <a href="MultiPlayer%20Games.htm">Brain</a>, create a new Class Library in Visual Studio, or 
your selected development platform, and add a reference to the SCG.SolarVengeance.Engine assembly.&nbsp; Then, create a new C# class and derive 
it from Brain (you will need to add &quot;using SCG.SolarVengeance.Engine&quot; to the 
class.&nbsp; You should give the Brain class name the same name as the source 
code file that you create.</p>
<p><font color="#FFFF00"><b>Brain</b></font><b><font color="#FFFF00"> Properties</font></b></p>
<font SIZE="2">
<p>These properties are available for override in your Brain class.</p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>virtual</b> <b>string</b></font><font SIZE="2"> Author<br>
Override this property to return your name, or Star Lord name.&nbsp; You want to 
get proper credit for your creation!</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>virtual</b> List&lt;StarShipType</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
AvailableShipTypes<br>
Override this method to return a list of the <a href="StarShips.htm">StarShip</a> types that your Brain 
should be allowed to build.&nbsp; StarShipType is 
an enum that contains the 24 different types of 
StarShips available.&nbsp; If you put more than 6 StarShip types in the list, 
SV5 will take only the first 6 in the list.&nbsp; If you try to build StarShips 
that are not in your available list, the build order will fail.</p>
</font></font><font SIZE="2" COLOR="#00FFFF">
<p><b>public abstract string</b></font><font SIZE="2"><b> </b>Description<br>
Override this property to return a description of your Brain.&nbsp; This appears 
when the Brain is clicked in the Brain list.</font></p>
<p><b><font color="#FFFF00">The Brain Logic</font></b></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>abstract</b> <b>void</b></font><font SIZE="2"> Execute();<br>
Override the Execute method and implement the main Brain logic here.&nbsp; Solar 
Vengeance will call the Execute method of your Brain every 10 
<a href="Impulses%20and%20Movement.htm">Impulses</a>.&nbsp; 
Your Brain logic will call methods in the Brain API (see below) to build and 
command <a href="StarShips.htm">StarShips</a> and perform other actions.</font></p>
<p><b><font SIZE="2" color="#FFFF00">The Brain API</font></b></p>
<p><font SIZE="2">These methods should be called from within your Execute 
method, and allow you to reproduce all of the orders that are available to 
normal players.&nbsp; They also expose game state information that the Brain has 
knowledge of.</font></p>
<p><b><font color="#FFFF00">Miscellaneous Properties and Methods</font></b></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;BlackHoleInfo</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
BlackHoles<br>
Provides access to a list of BlackHoleInfo objects that represent the Black 
Holes visible to the Brain.&nbsp; The BlackHoleInfo object contains a Location 
property, as well as X and Y properties, all of which return the Black Hole's 
position.</p>
</font>
<p>
<font SIZE="2" COLOR="#00FFFF"><b>
protected</b> StarSystemInfo</font><font SIZE="2"> Capital<br>
Returns a <a href="StarShipInfo%20Class.htm">StarSystemInfo</a> object that represents the Brain's Capital 
<a href="StarSystems.htm">StarSystem</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>double</b></font><font SIZE="2"> Distance(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
x1, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y1,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> x2,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y2)<br>
Calculates the accurate distance between two points.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>int</b></font><font SIZE="2"> DistanceQuick(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
x1, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y1,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> x2,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y2)<br>
Returns a quick calculation of distance between two points by adding the 
absolute values of the differences of the x and y coordinates.&nbsp; The 
performance of this method is much faster than the Distance method.</p>
</font>
<p><font SIZE="2" COLOR="#00FFFF"><b>
protected</b> <b>internal</b> StarShipInfo</font><font SIZE="2"> 
FindStarShip(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
code)<br>
This method allows the Brain to locate a <a href="StarShipInfo%20Class.htm">StarShipInfo</a> object that has the 
specified 3-character code.&nbsp; Each <a href="StarShips.htm">StarShip</a> has a unique 3 character code 
that can be used to uniquely identify it.&nbsp; If a StarShip with the 
corresponding code could not be found, the methods returns null.&nbsp; This 
might occur because a StarShip previously identified has been destroyed, or 
because it is no longer visible to the Brain.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>internal</b> StarSystemInfo</font><font SIZE="2"> 
FindStarSystem(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
name)<br>
This method allows the Brain to locate a <a href="StarSystemInfo%20Class.htm">StarSystemInfo</a> object by the name of 
the <a href="StarSystems.htm">StarSystem</a> it represents.&nbsp; If a corresponding StarSystem could not be 
found, the methods returns null.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> TerrainType</font><font SIZE="2"> GetTerrain(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
x, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y)<br>
Returns the type of terrain at the specified coordinate.&nbsp; Possible values 
are Clear or Nebula.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>bool</b></font><font SIZE="2"><font color="#00FFFF"> </font>
IsMultiPlayerGame<br>
Returns true if this game is a MultiPlayer game being played on a PrismServer.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>bool</b></font><font SIZE="2"> IsPlayerHuman(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
playerName)<br>
Returns true if the specified player is a human.&nbsp; If the player is being 
controlled by a computer Brain the method returns false.</p>
</font>
<p><b><font SIZE="2" color="#00FFFF">
protected int</font><font SIZE="2" COLOR="#0000ff"> </font></b>
<font SIZE="2">MapHeight</font><b><font SIZE="2" COLOR="#0000ff"><br>
</font><font SIZE="2" color="#00FFFF">protected</font></b><font SIZE="2" color="#00FFFF">
<b>int</b></font><font SIZE="2"> MapWidth<br>
These properties return the dimensions of the 
<a href="Interstellar%20Empires.htm">map playing field</a>.</font></p>
<p>
<font SIZE="2" COLOR="#00FFFF"><b>
protected</b> IList&lt;StarShipInfo</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
MyStarShips<br>
This property provides access to a list of <a href="StarShipInfo%20Class.htm">StarShipInfo</a> objects that represent 
all of the <a href="StarShips.htm">StarShips</a> owned by the Brain.</font></p>
<p><font SIZE="2" COLOR="#00FFFF"><b>
protected</b> <b>string</b></font><font SIZE="2"> Name<br>
The Name property returns the name of the Player that is controlling the Brain.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;<b>string</b></font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
PlayerNames<br>
Returns a list of player names for all of the players currently in the game (not 
eliminated.)</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;PulsarInfo</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
Pulsars<br>
Provides access to a list of PulsarInfo objects that represent the Pulsars that 
are visible to the Brain.&nbsp; The PulsarInfo class contains a Location 
property (Point), and X and Y properties that specify the location of the 
Pulsar.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>int</b></font><font SIZE="2"> Random(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
from, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> to)<br>
Returns a random integer within a range of values, inclusive of the from and to 
values.&nbsp; You can also access a static instance of the Math.Random class in 
the SVGame class via the RND static property.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;StarShipInfo</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
StarShips<br>
This property provides access to a list of <a href="StarShipInfo%20Class.htm">StarShipInfo</a> objects that represent 
all of the <a href="StarShips.htm">StarShips</a> that are currently visible to the Brain.&nbsp; This 
includes the StarShips owned by the Brain.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;StarSystemInfo</font><font SIZE="2"><font color="#00FFFF">&gt;</font> 
StarSystems<br>
This property provides access to a list of <a href="StarSystemInfo%20Class.htm">StarSystemInfo</a> objects that represent 
the <a href="StarSystems.htm">StarSystems</a> on the map.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>double</b></font><font SIZE="2"> TechMultiple<br>
This property returns the current Tech Multiple of the Brain.&nbsp; Tech 
Multiple determines how quickly <a href="StarSystems.htm">StarSystems</a> generate Resources, and can be 
increased by building <a href="TechShip.htm">TechShips</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b></font><font SIZE="2"> </font><font SIZE="2" COLOR="#00FFFF">
IList</font><font SIZE="2">&lt;</font><font SIZE="2" COLOR="#00FFFF">UDOInfo</font><font SIZE="2">&gt; 
UDOs<br>
This property returns a list of the <a href="UDOs.htm">UDOs</a> in the game that 
the Brain can currently see.&nbsp; The UDOInfo class provides the Location (and 
X,Y coordinates) of the UDO, as well as a Carrier property that returns a 
StarShipInfo object representing the StarShip that is carrying the UDO, or null 
if it is not being carried.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> IList&lt;WormholeInfo</font><font SIZE="2"><font color="#00FFFF">&gt;
</font>Wormholes<br>
This property provides access to a list of WormholeInfo objects that represent 
the <a href="Interstellar%20Empires.htm">Wormholes</a> that are currently visible to the Brain.&nbsp; 
The WormholeInfo object returns the Location (and x,y coordinates) of the 
Wormhole.&nbsp; It also contains the Destination property which corresponds to 
the Wormhole's exit point (if known).&nbsp; Finally, the DestinationKnown (bool) 
property returns whether or not the Brain knows the Wormhole's exit point.</font></p>
<p><b><font color="#FFFF00">StarSystem Command Methods</font></b></p>
<p>The Brain uses these methods to perform <a href="StarSystem%20Orders.htm">actions at StarSystems</a> that it owns.&nbsp; 
If you call one of these methods using a StarSystem not owned by the Brain, it 
does nothing.</p>
<p><font SIZE="2" COLOR="#00FFFF"><b>protected</b> <b>void</b></font><font SIZE="2"> 
BuildScanners(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
number)<br>
Instructs the Brain the build Scanners at a <a href="StarSystems.htm">StarSystem</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> BuildShields(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
number)<br>
Instructs the Brain to build Shields at a <a href="StarSystems.htm">StarSystem</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> BuildStarShip(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF">StarShipType</font><font SIZE="2"> 
shipType, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
engines, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
value, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
cloaked)<br>
Instructs the Brain to build a <a href="StarShips.htm">StarShip</a> at the specified
<a href="StarSystems.htm">StarSystem</a>.&nbsp; The 
StarShip will be built in one of the available spaces next to the StarSystem, 
assuming it has enough Resources.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SetAutoScanners(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
autoScannersOn)<br>
Instructs the Brain to turn auto-Scanner building on or off at a 
<a href="StarSystems.htm">StarSystem</a>.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SetAutoShields(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
autoShieldsOn)<br>
Instructs the Brain to turn auto-Shield building on or off at a 
<a href="StarSystems.htm">StarSystem</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SetAutoStarShip(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
autoStarShipOn)<br>
Instructs the Brain to turn auto-StarShip building on or off at a 
<a href="StarSystems.htm">StarSystem</a>.&nbsp; 
Use the SetAutoStarShipType method to set the type of <a href="StarShips.htm">StarShip</a> to auto-build.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SetAutoStarShipType(</font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system, </font><font SIZE="2" COLOR="#00FFFF">StarShipType</font><font SIZE="2"> 
shipType, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
engines, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
value, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
cloaked)<br>
Sets the type of <a href="StarShips.htm">StarShip</a> that will be built when the Brain turns on auto-build 
StarShips for the <a href="StarSystems.htm">StarSystem</a> specified.</font></p>
<p><b><font color="#FFFF00">StarShip Command Methods</font></b></p>
<p>The Brain calls these methods to command the <a href="StarShips.htm">StarShips</a> that it owns.&nbsp; If 
you call one of these methods using a StarShip that the Brain does not own, it 
does nothing.</p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> AttackAdjacent(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
attack)<br>
Turns on or off the Attack Adjacent behavior of <a href="StarShips.htm">StarShips</a>.&nbsp; When on, the 
StarShip will attack any adjacent enemy StarShip automatically.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> BuildStarShip(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarShipType</font><font SIZE="2"> 
shipType, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
engines, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
value, </font><font SIZE="2" COLOR="#00FFFF"><b>bool</b></font><font SIZE="2"> 
cloaked)<br>
Instructs the <a href="BattleStation.htm">BattleStation</a> specified in the 
&quot;ship&quot; parameter to build a StarShip with its accumulated Resources.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> ClearOrder(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship)<br>
Instructs the Brain to clear any current order that the <a href="StarShips.htm">StarShip</a> might have.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> CreateJumpGate(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship)<br>
Instructs a <a href="JumpGateShip.htm">JumpGateShip</a> to create a JumpGate at 
its current location.&nbsp; A JumpGate will be created only if one was not 
already created by a JumpGateShip that was created at the same 
<a href="StarSystems.htm">StarSystem</a> as the 
ship being commanded here.</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Defend(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system)</font><b><font SIZE="2" COLOR="#0000ff"><br>
</font><font SIZE="2" color="#00FFFF">protected</font></b><font SIZE="2" color="#00FFFF">
<b>void</b></font><font SIZE="2"> Defend(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
defendShip)<br>
</font><font SIZE="2" COLOR="#00FFFF"><b>protected</b> <b>void</b></font><font SIZE="2"><font color="#00FFFF">
</font>Defend(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">Point</font><font SIZE="2"> pt)<br>
Instructs the <a href="StarShips.htm">StarShip</a> to defend the specified target
<a href="StarSystems.htm">StarSystem</a>, <a href="StarShips.htm">StarShip</a>, or 
point on the map.&nbsp; This behavior is the same as the<a href="StarShip%20Orders.htm"> Defend manual order</a> for StarShips.&nbsp; 
This order will only succeed if the StarShip is capable of attacking other 
StarShips.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> DetonateMadBomb(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship)<br>
The Brain can detonate any MadBombs that it sees and identifies on the map, 
whether they belong to the Brain's player or not.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> EjectUDOs(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship)<br>
Causes the StarShip to eject any <a href="UDOs.htm">UDOs</a> it might be 
carrying.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Escort(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
escortTarget, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
offsetX, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
offsetY)<br>
Instructs the <a href="StarShips.htm">StarShip</a> to perform the Escort order for the target StarShip, 
using the specified X and Y offsets for formation.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Move(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> x,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y)<br>
Instructs the <a href="StarShips.htm">StarShip</a> to move the specified coordinates.&nbsp; If the 
coordinates are off the map, they are truncated to within the map dimensions.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SetRemoteViewPoint(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> x,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y)<br>
Sets the space on the map that a <a href="RemoteViewer.htm">RemoteViewer</a> 
will view.&nbsp; Once this is set, calling this method again will not change it.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Target(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
system)<br>
Instructs the <a href="StarShips.htm">StarShip</a> to target the specified
<a href="StarSystems.htm">StarSystem</a>.&nbsp; This order applies 
not only to <a href="WarShip.htm">WarShips</a> and other StarShips that can 
attack StarSystems, but also to ships like <a href="GravShip.htm">GravShips</a> 
and <a href="ShieldGenerator.htm">ShieldGenerators</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Target(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
target)<br>
Instructs the <a href="StarShips.htm">StarShip</a> to target the specified enemy StarShip.&nbsp; This order applies 
not only to <a href="WarShip.htm">WarShips</a> and other StarShips that can 
attack StarShips, but also to ships like <a href="RepairShip.htm">RepairShips</a> 
and <a href="Tug.htm">Tugs</a>.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Transport(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, </font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
from, </font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
to)<br>
Instructs the <a href="Freighter.htm">Freighter</a> to transport Resources from one
<a href="StarSystems.htm">StarSystem</a> to another.</font></p>
<p>
<font SIZE="2" COLOR="#00FFFF"><b>
protected</b> <b>void</b></font><font SIZE="2"> TransportBS(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship, <font color="#00FFFF">StarShipInfo</font> battleStation, </font><font SIZE="2" COLOR="#00FFFF">StarSystemInfo</font><font SIZE="2"> 
to)<br>
Instructs the Freighter to transport Resources from a
<a href="BattleStation.htm">BattleStation</a> to a StarSystem.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Transport2(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
info, </font><font SIZE="2" COLOR="#00FFFF">List</font><font SIZE="2">&lt;</font><font SIZE="2" COLOR="#00FFFF">SVObjectInfo</font><font SIZE="2">&gt; 
sources, </font><font SIZE="2" COLOR="#00FFFF">SVObjectInfo</font><font SIZE="2"> 
destination)<br>
This method provides an updated Transport mechanism that was introduced in 
SV5.1.&nbsp; You can specify a list of sources, which can be StarSystems or
<a href="BattleStation.htm">BattleStations</a>, and a destination, which can 
also be a StarSystem or <a href="BattleStation.htm">BattleStation</a>.&nbsp; The 
SVObjectInfo is a base class that both <a href="StarSystemInfo%20Class.htm">
StarSystemInfo</a> and <a href="StarShipInfo%20Class.htm">StarShipInfo</a> are 
derived from.&nbsp; So, you can add either of these object types to the sources 
list, and assign either type as the destination.</p>
</font>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> Release(</font><font SIZE="2" COLOR="#00FFFF">StarShipInfo</font><font SIZE="2"> 
ship)<br>
Instructs the <a href="GravShip.htm">GravShip</a> to release the 
<a href="StarSystems.htm">StarSystem</a> it 
is dragging, or the <a href="Tug.htm">Tug</a> to release the StarShip it is 
tugging.</font></p>
<p><b><font color="#FFFF00">Finding Closest Items</font></b></p>
<p>One of the things Brains need to frequently do is find the closest 
<a href="StarSystems.htm">StarSystem</a> 
or <a href="StarShips.htm">StarShip</a> to a specific location.&nbsp; The following methods provide a 
flexible way to achieve this.</p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b></font><font SIZE="2"> </font><font SIZE="2" COLOR="#00FFFF">
StarSystemInfo</font><font SIZE="2"> ClosestStarSystem(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
x, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
maxDistance, </font><font SIZE="2" COLOR="#00FFFF">FindSystemFlags</font><font SIZE="2"> 
findType)<br>
Returns the closest <a href="StarSystems.htm">StarSystem</a> within the specified range (maxDistance).&nbsp; 
Use the findType parameter to determine what types of StarSystems to consider in 
the search.&nbsp; This is a enum flags type that has the following possible 
values:</font></p>
<font SIZE="2">
<p></font><font SIZE="2" COLOR="#00FFFF"><b>public</b> <b>enum</b> 
FindSystemFlags</font><font SIZE="2"><br>
{<br>
&nbsp;&nbsp;&nbsp; Owned = 1, Independent = 2, NonVisible = 4, Allied = 8, Enemy 
= 16,<br>
&nbsp;&nbsp;&nbsp; All = Owned + Independent + NonVisible + Allied + Enemy,<br>
&nbsp;&nbsp;&nbsp; Visible = Owned + Independent + Allied + Enemy,<br>
&nbsp;&nbsp;&nbsp; Friendly = Owned + Allied,<br>
&nbsp;&nbsp;&nbsp; Unfriendly = Independent + NonVisible + Enemy,<br>
&nbsp;&nbsp;&nbsp; VisibleUnfriendly = Independent + Enemy<br>
};</p>
</font><font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> StarShipInfo</font><font SIZE="2"> ClosestStarShip(</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
x, </font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> y,
</font><font SIZE="2" COLOR="#00FFFF"><b>int</b></font><font SIZE="2"> 
maxDistance, </font><font SIZE="2" COLOR="#00FFFF">FindShipFlags</font><font SIZE="2"> 
findType, </font><font SIZE="2" COLOR="#00FFFF">ShipKnownFlags</font><font SIZE="2"> 
known)<br>
Returns the closest <a href="StarShips.htm">StarShip</a> within the specified range (maxDistance).&nbsp; The 
findType limits the type of StarShip to include in the search.&nbsp; It is an 
enum flags type with the possible values of Owned, Allied, and Enemy.&nbsp; 
Owned and Allied states are exclusive; Allied does not include StarShips that 
you own.&nbsp; Use the Friendly value (Owned + Allied) to include all friendly 
StarShips in the search.&nbsp; The final parameter determines whether to include 
StarShips that have been identified by the Brain, those that have not, or 
either.</p>
</font>
<p><b><font color="#FFFF00">Alliance Related</font></b></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> AllianceLevel</font><font SIZE="2"><font color="#00FFFF">
</font>AlliedWith(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
playerName)<br>
This method returns the current state of <a href="Alliances.htm">alliance</a> that the Brain has toward the 
Player with the specified name.&nbsp; AllianceLevel is an enum type that has 
values of None, NonAggression, Intelligence, and Formal to represent the 3 
alliance levels.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> AllianceLevel</font><font SIZE="2"><font color="#00FFFF">
</font>AlliedWithMe(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
playerName)<br>
This method allows the Brain to determine if other Players have 
<a href="Alliances.htm">allied</a> with it.</font></p>
<p><font SIZE="2" COLOR="#00FFFF"><b>
protected</b> <b>void</b></font><font SIZE="2"> SetAlliance(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
playerName, </font><font SIZE="2" COLOR="#00FFFF">AllianceLevel</font><font SIZE="2"> 
al)<br>
This method allows the Brain to set an <a href="Alliances.htm">alliance</a> with the Player specified by 
name.</font></p>
<p><b><font SIZE="2" color="#FFFF00">Brain Data</font></b></p>
<p>The Brain Data facility gives you the ability to save local variables that 
your Brain uses to the saved game file when a game is saved, and restore them 
when a game is loaded.&nbsp; Using this facility is not strictly necessary, you 
can always let your Brain re-learn its state when a saved game is loaded.&nbsp; 
But if you wish to save Brain-related data, use the methods below.</p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>virtual</b> <b>string</b></font><font SIZE="2"><font color="#00FFFF">
</font>GetBrainData()<br>
Override this method if you wish to save local variable information of the Brain 
in a save game file.&nbsp; The data must be packed into a single string, and 
returned in this method.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>virtual</b> <b>void</b></font><font SIZE="2"> ParseBrainData(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
brainData)<br>
This method will be called by SV5 when a save game file is loaded and your Brain 
had used GetBrainData to specify data to save in the file.&nbsp; You are 
provided the string that you previously returned in the GetBrainData method.&nbsp; 
Parse the string into your Brain's local variables.</p>
</font>
<p><b><font SIZE="2" color="#FFFF00">Interfacing with MultiPlayer Chat</font></b></p>
<p>Your Brain can interact with MultiPlayer chat in the <a href="Alliances.htm">
Diplomacy</a> interface by using the methods below.</p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>public</b> <b>virtual</b> <b>void</b></font><font SIZE="2"> IncomingMessage(</font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
playerName, </font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
message)<br>
SV5 calls this method whenever an incoming chat message was sent to the Player 
your Brain is controlling.&nbsp; To receive these messages, override this method 
in your Brain code.&nbsp; If you wish to use this message somehow in your 
Execute method, you need to save it to a local variable or List.&nbsp; If you do 
this, be sure that you provide thread-safe access to the local variable used, 
because the incoming message is received in a different thread than the one that 
executes your Execute method.</font></p>
<font SIZE="2" COLOR="#00FFFF"><b>
<p>protected</b> <b>void</b></font><font SIZE="2"> SendMessage(</font><font SIZE="2" COLOR="#00FFFF">ChatChannel</font><font SIZE="2"> 
channel, </font><font SIZE="2" COLOR="#00FFFF"><b>string</b></font><font SIZE="2"> 
msg)<br>
Call this method to send a line of chat to other Players in a MultiPlayer game.&nbsp; 
You can call this in response to IncomingMessage, above, or in the Execute 
method.&nbsp; The ChatChannel parameter controls who the message will be sent 
to, and can have the value of All, Friendly, or Enemy.</p>
<p><b><font color="#FFFF00">How to Install your Brain</font></b></p>
<p>Making your Brain available to Solar Vengeance 5 could not be easier.&nbsp; 
Simply copy or move the .cs source code file of your Brain into the 
&quot;Brains&quot; folder under SV5's main installation folder.&nbsp; The next time you 
start SV5, your Brain will be available in the Brains list.&nbsp; You can also 
provide a custom image to represent your Brain.&nbsp; Create a 32x32 bitmap with 
the same file name as the Brain source code, and place it in the Brains folder 
along with the .cs file.</p>
</font>

</body>

</html>